package com.demo.model;

import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

// 一个类中多个@Bean

@Component
public class Students {

    @Bean
    public Student student1() {
        Student student = new Student();
        student.setId(1);
        student.setName("小周");
        student.setAge(18);
        return student;
    }

    @Bean
    public Student student2() {
        Student student = new Student();
        student.setId(2);
        student.setName("小蔡");
        student.setAge(20);
        return student;
    }
}
